package com.example.mapper;

import com.example.pojo.Brand;
import com.example.pojo.Good;
import com.example.pojo.GoodType;
import com.opencsv.CSVReader;
import com.opencsv.exceptions.CsvValidationException;
import org.apache.ibatis.annotations.*;

import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

@Mapper
public interface GoodTypeMapper {

    List<GoodType> getGoodType(GoodType goodType);

    @Insert("INSERT INTO type values (#{typeCode},#{typeName},#{typeImg},#{lastType})")
    void addGoodType(GoodType supplier);

    @Update("UPDATE type set typeCode=#{typeCode},typeName=#{typeName},typeImg=#{typeImg},lastType=#{lastType} where typeCode=#{typeCode}")
    void changeGoodType(GoodType goodType);

    @Delete("delete from type where typeCode=#{id}")
    Integer deleteGoodType(String id);

    @Select("select count(*) from type where lastType=#{id}")
    int findLastType(String id);

    @Select("select * from type")
    List<GoodType> getGoodTypeList();
}
